﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QiCheXiaoShouYongHu1
{
    public partial class HouQuDiJia : Form
    {
        string name;
        public HouQuDiJia()
        {
            InitializeComponent();
        }

        public HouQuDiJia(string name1)
        {
            InitializeComponent();
            name = name1;
        }

        private void HouQuDiJia_Load(object sender, EventArgs e)
        {
            string sql = string.Format("select * from Car where QiCheMing='{0}'", name);
            DataTable table = DBHelper.Read(sql);
            this.label1.Text = table.Rows[0]["QiCheMing"].ToString();
            string zx = table.Rows[0]["lujin"].ToString();
            this.pictureBox1.Image = Image.FromFile(zx);

            DataTable table1 = DBHelper.Read("select * from Shengfen");
            this.comboBox2.DisplayMember = "ShengFen";
            this.comboBox2.ValueMember = "SFid";
            this.comboBox2.DataSource = table1;
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            int SFid = Convert.ToInt32(this.comboBox2.SelectedValue);
            string sql = string.Format(" select * from Chengshi where SFid={0}", SFid);
            DataTable table = DBHelper.Read(sql);
            this.comboBox1.DisplayMember = "ChengShi";
            this.comboBox1.ValueMember = " SFid";
            this.comboBox1.DataSource = table;
        }
    }
}
